﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract DokumentTemplateStavka typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class DokumentTemplateStavkaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<DokumentTemplateStavkaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.DokumentTemplateStavka _currentDokumentTemplateStavka = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxDokumentTemplateStavkaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxDokumentTemplateStavkaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxDokumentTemplateStavkaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDArtikl property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDArtiklDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kolicina property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKolicinaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kolicina2 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKolicina2DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kolicina3 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKolicina3DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Vrijednost property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxVrijednostDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Vrijednost2 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxVrijednost2DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Vrijednost3 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxVrijednost3DataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Postotak property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPostotakDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Postotak2 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPostotak2DataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDDokument property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDDokumentDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDValuta property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDValutaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDValuta2 property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDValuta2DataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Artikl> _IDArtiklList;
		
		/// <summary> 
		/// The list of selectable Artikl
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Artikl> IDArtiklList
		{
			get {return this._IDArtiklList;}
			set 
			{
				this._IDArtiklList = value;
				this.uxIDArtiklDataGridViewColumn.DataSource = null;
				this.uxIDArtiklDataGridViewColumn.DataSource = this._IDArtiklList;
			}
		}
		
		private bool _allowNewItemInIDArtiklList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Artikl
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDArtiklList
		{
			get { return _allowNewItemInIDArtiklList;}
			set
			{
				this._allowNewItemInIDArtiklList = value;
				this.uxIDArtiklDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Dokument> _IDDokumentList;
		
		/// <summary> 
		/// The list of selectable Dokument
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Dokument> IDDokumentList
		{
			get {return this._IDDokumentList;}
			set 
			{
				this._IDDokumentList = value;
				this.uxIDDokumentDataGridViewColumn.DataSource = null;
				this.uxIDDokumentDataGridViewColumn.DataSource = this._IDDokumentList;
			}
		}
		
		private bool _allowNewItemInIDDokumentList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Dokument
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDDokumentList
		{
			get { return _allowNewItemInIDDokumentList;}
			set
			{
				this._allowNewItemInIDDokumentList = value;
				this.uxIDDokumentDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Valuta> _IDValutaList;
		
		/// <summary> 
		/// The list of selectable Valuta
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Valuta> IDValutaList
		{
			get {return this._IDValutaList;}
			set 
			{
				this._IDValutaList = value;
				this.uxIDValutaDataGridViewColumn.DataSource = null;
				this.uxIDValutaDataGridViewColumn.DataSource = this._IDValutaList;
			}
		}
		
		private bool _allowNewItemInIDValutaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Valuta
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDValutaList
		{
			get { return _allowNewItemInIDValutaList;}
			set
			{
				this._allowNewItemInIDValutaList = value;
				this.uxIDValutaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Valuta> _IDValuta2List;
		
		/// <summary> 
		/// The list of selectable Valuta
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Valuta> IDValuta2List
		{
			get {return this._IDValuta2List;}
			set 
			{
				this._IDValuta2List = value;
				this.uxIDValuta2DataGridViewColumn.DataSource = null;
				this.uxIDValuta2DataGridViewColumn.DataSource = this._IDValuta2List;
			}
		}
		
		private bool _allowNewItemInIDValuta2List;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Valuta
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDValuta2List
		{
			get { return _allowNewItemInIDValuta2List;}
			set
			{
				this._allowNewItemInIDValuta2List = value;
				this.uxIDValuta2DataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.DokumentTemplateStavka> _DokumentTemplateStavkaList;
				
		/// <summary> 
		/// The list of DokumentTemplateStavka to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.DokumentTemplateStavka> DokumentTemplateStavkaList
		{
			get {return this._DokumentTemplateStavkaList;}
			set
			{
				this._DokumentTemplateStavkaList = value;
				this.uxDokumentTemplateStavkaBindingSource.DataSource = null;
				this.uxDokumentTemplateStavkaBindingSource.DataSource = value;
				this.uxDokumentTemplateStavkaDataGridView.DataSource = null;
				this.uxDokumentTemplateStavkaDataGridView.DataSource = this.uxDokumentTemplateStavkaBindingSource;				
				//this.uxDokumentTemplateStavkaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxDokumentTemplateStavkaBindingSource_ListChanged);
				this.uxDokumentTemplateStavkaBindingSource.CurrentItemChanged += new System.EventHandler(OnDokumentTemplateStavkaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnDokumentTemplateStavkaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentDokumentTemplateStavka = uxDokumentTemplateStavkaBindingSource.Current as Entities.DokumentTemplateStavka;
			
			if (_currentDokumentTemplateStavka != null)
			{
				_currentDokumentTemplateStavka.Validate();
			}
			//_DokumentTemplateStavka.Validate();
			OnCurrentEntityChanged();
		}

		//void uxDokumentTemplateStavkaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.DokumentTemplateStavka"/> instance.
		/// </summary>
		public Entities.DokumentTemplateStavka SelectedDokumentTemplateStavka
		{
			get {return this._currentDokumentTemplateStavka;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxDokumentTemplateStavkaDataGridView.VirtualMode;}
			set
			{
				this.uxDokumentTemplateStavkaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxDokumentTemplateStavkaDataGridView.AllowUserToAddRows;}
			set {this.uxDokumentTemplateStavkaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxDokumentTemplateStavkaDataGridView.AllowUserToDeleteRows;}
			set {this.uxDokumentTemplateStavkaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxDokumentTemplateStavkaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxDokumentTemplateStavkaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="DokumentTemplateStavkaDataGridViewBase"/> class.
		/// </summary>
		public DokumentTemplateStavkaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxDokumentTemplateStavkaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxDokumentTemplateStavkaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxDokumentTemplateStavkaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDArtiklDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxKolicinaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKolicina2DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKolicina3DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxVrijednostDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxVrijednost2DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxVrijednost3DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPostotakDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPostotak2DataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDDokumentDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDValutaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDValuta2DataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxIDArtiklBindingSource = new ArtiklBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklBindingSource)).BeginInit();
			//this.uxIDDokumentBindingSource = new DokumentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDokumentBindingSource)).BeginInit();
			//this.uxIDValutaBindingSource = new ValutaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDValutaBindingSource)).BeginInit();
			//this.uxIDValuta2BindingSource = new ValutaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDValuta2BindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxDokumentTemplateStavkaErrorProvider
			// 
			this.uxDokumentTemplateStavkaErrorProvider.ContainerControl = this;
			this.uxDokumentTemplateStavkaErrorProvider.DataSource = this.uxDokumentTemplateStavkaBindingSource;						
			// 
			// uxDokumentTemplateStavkaDataGridView
			// 
			this.uxDokumentTemplateStavkaDataGridView.AutoGenerateColumns = false;
			this.uxDokumentTemplateStavkaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxDokumentTemplateStavkaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxIDArtiklDataGridViewColumn,
		this.uxKolicinaDataGridViewColumn,
		this.uxKolicina2DataGridViewColumn,
		this.uxKolicina3DataGridViewColumn,
		this.uxVrijednostDataGridViewColumn,
		this.uxVrijednost2DataGridViewColumn,
		this.uxVrijednost3DataGridViewColumn,
		this.uxPostotakDataGridViewColumn,
		this.uxPostotak2DataGridViewColumn,
		this.uxIDDokumentDataGridViewColumn,
		this.uxIDValutaDataGridViewColumn,
		this.uxIDValuta2DataGridViewColumn			});
			this.uxDokumentTemplateStavkaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxDokumentTemplateStavkaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxDokumentTemplateStavkaDataGridView.Name = "uxDokumentTemplateStavkaDataGridView";
			this.uxDokumentTemplateStavkaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxDokumentTemplateStavkaDataGridView.TabIndex = 0;	
			this.uxDokumentTemplateStavkaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxDokumentTemplateStavkaDataGridView.EnableHeadersVisualStyles = false;
			this.uxDokumentTemplateStavkaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnDokumentTemplateStavkaDataGridViewDataError);
			this.uxDokumentTemplateStavkaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDokumentTemplateStavkaDataGridViewCellValueNeeded);
			this.uxDokumentTemplateStavkaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnDokumentTemplateStavkaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDArtiklDataGridViewColumn
			//
			this.uxIDArtiklDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDArtiklDataGridViewColumn.DataPropertyName = "IDArtikl";
			this.uxIDArtiklDataGridViewColumn.HeaderText = "IDArtikl";
			this.uxIDArtiklDataGridViewColumn.Name = "uxIDArtiklDataGridViewColumn";
			this.uxIDArtiklDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDArtiklDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDArtiklDataGridViewColumn.ReadOnly = false;		
			//
			// uxKolicinaDataGridViewColumn
			//
			this.uxKolicinaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKolicinaDataGridViewColumn.DataPropertyName = "Kolicina";
			this.uxKolicinaDataGridViewColumn.HeaderText = "Kolicina";
			this.uxKolicinaDataGridViewColumn.Name = "uxKolicinaDataGridViewColumn";
			this.uxKolicinaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKolicinaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKolicinaDataGridViewColumn.ReadOnly = false;		
			//
			// uxKolicina2DataGridViewColumn
			//
			this.uxKolicina2DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKolicina2DataGridViewColumn.DataPropertyName = "Kolicina2";
			this.uxKolicina2DataGridViewColumn.HeaderText = "Kolicina2";
			this.uxKolicina2DataGridViewColumn.Name = "uxKolicina2DataGridViewColumn";
			this.uxKolicina2DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKolicina2DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKolicina2DataGridViewColumn.ReadOnly = false;		
			//
			// uxKolicina3DataGridViewColumn
			//
			this.uxKolicina3DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKolicina3DataGridViewColumn.DataPropertyName = "Kolicina3";
			this.uxKolicina3DataGridViewColumn.HeaderText = "Kolicina3";
			this.uxKolicina3DataGridViewColumn.Name = "uxKolicina3DataGridViewColumn";
			this.uxKolicina3DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKolicina3DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKolicina3DataGridViewColumn.ReadOnly = false;		
			//
			// uxVrijednostDataGridViewColumn
			//
			this.uxVrijednostDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxVrijednostDataGridViewColumn.DataPropertyName = "Vrijednost";
			this.uxVrijednostDataGridViewColumn.HeaderText = "Vrijednost";
			this.uxVrijednostDataGridViewColumn.Name = "uxVrijednostDataGridViewColumn";
			this.uxVrijednostDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxVrijednostDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxVrijednostDataGridViewColumn.ReadOnly = false;		
			//
			// uxVrijednost2DataGridViewColumn
			//
			this.uxVrijednost2DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxVrijednost2DataGridViewColumn.DataPropertyName = "Vrijednost2";
			this.uxVrijednost2DataGridViewColumn.HeaderText = "Vrijednost2";
			this.uxVrijednost2DataGridViewColumn.Name = "uxVrijednost2DataGridViewColumn";
			this.uxVrijednost2DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxVrijednost2DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxVrijednost2DataGridViewColumn.ReadOnly = false;		
			//
			// uxVrijednost3DataGridViewColumn
			//
			this.uxVrijednost3DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxVrijednost3DataGridViewColumn.DataPropertyName = "Vrijednost3";
			this.uxVrijednost3DataGridViewColumn.HeaderText = "Vrijednost3";
			this.uxVrijednost3DataGridViewColumn.Name = "uxVrijednost3DataGridViewColumn";
			this.uxVrijednost3DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxVrijednost3DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxVrijednost3DataGridViewColumn.ReadOnly = false;		
			//
			// uxPostotakDataGridViewColumn
			//
			this.uxPostotakDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPostotakDataGridViewColumn.DataPropertyName = "Postotak";
			this.uxPostotakDataGridViewColumn.HeaderText = "Postotak";
			this.uxPostotakDataGridViewColumn.Name = "uxPostotakDataGridViewColumn";
			this.uxPostotakDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPostotakDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPostotakDataGridViewColumn.ReadOnly = false;		
			//
			// uxPostotak2DataGridViewColumn
			//
			this.uxPostotak2DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPostotak2DataGridViewColumn.DataPropertyName = "Postotak2";
			this.uxPostotak2DataGridViewColumn.HeaderText = "Postotak2";
			this.uxPostotak2DataGridViewColumn.Name = "uxPostotak2DataGridViewColumn";
			this.uxPostotak2DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPostotak2DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPostotak2DataGridViewColumn.ReadOnly = false;		
			//
			// uxIDDokumentDataGridViewColumn
			//
			this.uxIDDokumentDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDokumentDataGridViewColumn.DataPropertyName = "IDDokument";
			this.uxIDDokumentDataGridViewColumn.HeaderText = "IDDokument";
			this.uxIDDokumentDataGridViewColumn.Name = "uxIDDokumentDataGridViewColumn";
			this.uxIDDokumentDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDokumentDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDokumentDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDValutaDataGridViewColumn
			//
			this.uxIDValutaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDValutaDataGridViewColumn.DataPropertyName = "IDValuta";
			this.uxIDValutaDataGridViewColumn.HeaderText = "IDValuta";
			this.uxIDValutaDataGridViewColumn.Name = "uxIDValutaDataGridViewColumn";
			this.uxIDValutaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDValutaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDValutaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDValuta2DataGridViewColumn
			//
			this.uxIDValuta2DataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDValuta2DataGridViewColumn.DataPropertyName = "IDValuta2";
			this.uxIDValuta2DataGridViewColumn.HeaderText = "IDValuta2";
			this.uxIDValuta2DataGridViewColumn.Name = "uxIDValuta2DataGridViewColumn";
			this.uxIDValuta2DataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDValuta2DataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDValuta2DataGridViewColumn.ReadOnly = false;		
			//
			// uxIDArtiklDataGridViewColumn
			//				
			this.uxIDArtiklDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDArtiklDataGridViewColumn.ValueMember = "ID";	
			this.uxIDArtiklDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDArtiklDataGridViewColumn.DataSource = uxIDArtiklBindingSource;				
				
			//
			// uxIDDokumentDataGridViewColumn
			//				
			this.uxIDDokumentDataGridViewColumn.DisplayMember = "IDDokumentTip";	
			this.uxIDDokumentDataGridViewColumn.ValueMember = "ID";	
			this.uxIDDokumentDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDDokumentDataGridViewColumn.DataSource = uxIDDokumentBindingSource;				
				
			//
			// uxIDValutaDataGridViewColumn
			//				
			this.uxIDValutaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDValutaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDValutaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDValutaDataGridViewColumn.DataSource = uxIDValutaBindingSource;				
				
			//
			// uxIDValuta2DataGridViewColumn
			//				
			this.uxIDValuta2DataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDValuta2DataGridViewColumn.ValueMember = "ID";	
			this.uxIDValuta2DataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDValuta2DataGridViewColumn.DataSource = uxIDValuta2BindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxDokumentTemplateStavkaDataGridView);
			this.Name = "DokumentTemplateStavkaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDokumentBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDValutaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDValuta2BindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxDokumentTemplateStavkaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				DokumentTemplateStavkaDataGridViewEventArgs args = new DokumentTemplateStavkaDataGridViewEventArgs();
				args.DokumentTemplateStavka = _currentDokumentTemplateStavka;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class DokumentTemplateStavkaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.DokumentTemplateStavka	_DokumentTemplateStavka;
	
			/// <summary>
			/// the  Entities.DokumentTemplateStavka instance.
			/// </summary>
			public Entities.DokumentTemplateStavka DokumentTemplateStavka
			{
				get { return _DokumentTemplateStavka; }
				set { _DokumentTemplateStavka = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxDokumentTemplateStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnDokumentTemplateStavkaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxDokumentTemplateStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDokumentTemplateStavkaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDokumentTemplateStavkaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].ID;
						break;
					case "uxIDArtiklDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].IDArtikl;
						break;
					case "uxKolicinaDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Kolicina;
						break;
					case "uxKolicina2DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Kolicina2;
						break;
					case "uxKolicina3DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Kolicina3;
						break;
					case "uxVrijednostDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Vrijednost;
						break;
					case "uxVrijednost2DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Vrijednost2;
						break;
					case "uxVrijednost3DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Vrijednost3;
						break;
					case "uxPostotakDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Postotak;
						break;
					case "uxPostotak2DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].Postotak2;
						break;
					case "uxIDDokumentDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].IDDokument;
						break;
					case "uxIDValutaDataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].IDValuta;
						break;
					case "uxIDValuta2DataGridViewColumn":
						e.Value = DokumentTemplateStavkaList[e.RowIndex].IDValuta2;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxDokumentTemplateStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnDokumentTemplateStavkaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxDokumentTemplateStavkaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxIDArtiklDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].IDArtikl = (System.Int32)e.Value;
						break;
					case "uxKolicinaDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Kolicina = (System.Single)e.Value;
						break;
					case "uxKolicina2DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Kolicina2 = (System.Single?)e.Value;
						break;
					case "uxKolicina3DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Kolicina3 = (System.Single?)e.Value;
						break;
					case "uxVrijednostDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Vrijednost = (System.Decimal?)e.Value;
						break;
					case "uxVrijednost2DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Vrijednost2 = (System.Decimal?)e.Value;
						break;
					case "uxVrijednost3DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Vrijednost3 = (System.Decimal?)e.Value;
						break;
					case "uxPostotakDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Postotak = (System.Single?)e.Value;
						break;
					case "uxPostotak2DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].Postotak2 = (System.Single?)e.Value;
						break;
					case "uxIDDokumentDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].IDDokument = (System.Int32)e.Value;
						break;
					case "uxIDValutaDataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].IDValuta = (System.Int32?)e.Value;
						break;
					case "uxIDValuta2DataGridViewColumn":
						DokumentTemplateStavkaList[e.RowIndex].IDValuta2 = (System.Int32?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
